<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_validate.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>文章修改</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__ADMIN__css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__ADMIN__css/animate.min.css" rel="stylesheet">
    <link href="__ADMIN__css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/switchery/switchery.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>文章修改</h5>
                </div>
                <div class="ibox-content">
                    <form action="{:U('Article/edit_save')}" method="post" class="form-horizontal m-t" id="signupForm" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="{$info.id}" />
                        <div class="form-group">
                            <label class="col-sm-3 control-label">所属栏目：</label>
                            <div class="col-sm-8">
                                <select class="form-control m-b" name="columns">
                                    <foreach name="list" item="vo" >
                                        <option value="{$vo.id}"
                                        <if condition="$info['pid'] eq $vo['id']">
                                            selected
                                        </if>>{$vo.title}</option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">文章名：</label>
                            <div class="col-sm-8">
                                <input id="title" name="title" class="form-control" type="text" aria-required="true" aria-invalid="false" class="valid" value="{$info.title}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">作者：</label>
                            <div class="col-sm-8">
                                <input id="author" name="author" class="form-control" type="text" value="{$info.author}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">文章内容：</label>
                            <div class="col-sm-8">
                                <!-- 加载编辑器的容器 -->
                                <script id="container" name="content" type="text/plain">
                                    {$info.content}
                                </script>
                                <!-- 配置文件 -->
                                <script type="text/javascript" src="__ADMIN__/editor/ueditor.config.js"></script>
                                <!-- 编辑器源码文件 -->
                                <script type="text/javascript" src="__ADMIN__/editor/ueditor.all.js"></script>
                                <!-- 实例化编辑器 -->
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                </script>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">缩略图上传：</label>
                            <div class="col-sm-8">
                                <input type="file"  name="img" id="img" class="js-switch" value="{$info.img}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">关键词：</label>
                            <div class="col-sm-8">
                                <input type="text"  name="keywords" id="keywords" class="js-switch" value="{$info.keywords}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">描述：</label>
                            <div class="col-sm-8">
                                <input type="text"  name="description" id="description" class="js-switch" value="{$info.description}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序：</label>
                            <div class="col-sm-8">
                                <input type="text"  name="sort" id="sort" class="js-switch" value="{$info.sort}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">状态：</label>
                            <div class="col-sm-8">
                                <input type="checkbox" value="1" name="status" id="status" class="js-switch" <if condition="$info['status'] eq 1"> checked</if>>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                                <button class="btn btn-defualt" type="reset" onclick="history.go(-1)">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.min.js"></script>
<script src="__ADMIN__js/plugins/switchery/switchery.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script>
    //表单验证自定义检测方法
    $(document).ready(function(){
        $.validator.addMethod('checkName',function(value, element, param){
            if(/^[(\u4e00-\u9fa5)a-zA-Z0-9_-]{3,16}$/.test(value)) {
                return true;
            }else{
                return false;
            }
        },"");
        //表单验证
        $('#signupForm').validate({
            rules: {
                title: {
                    required: true
                },
                author: {
                    required: true,
                    checkName:true
                },
                addtime: {
                    required: true,
                },
                content: {
                    required: true,
                },
                img: {
                    required: true,
                },
                keywords: {
                    required: true,
                },
                description: {
                    required: true,
                },
                sort: {
                    required: true,
                }
            },
            messages: {
                title: "请输入文章名名",
                author: {
                    required: "请输入作者名",
                    checkName:"不能包含特殊字符"
                },
                addtime: "请输入添加时间",
                content: "请输入文章内容",
                img:"请上传缩略图",
                keywords:"请输入关键词",
                description:"请添加描述",
                sort:"请输入排序"
            },
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    success:function(data){
                        if(data.status > 0){
                            layer.msg(data.msg, {icon: 6,time: 1000}, function(){
                                window.location.href="{:U('article/index')}";
                            });
                        }else{
                            layer.msg(data.msg, {icon: 5,time: 1000},function(){
                                window.location.href="{:U('article/add')}";
                            });
                        }
                    },
                    datatype:'json'
                })
            }
        });
        //开关按钮实例化
        var elem = document.querySelector('.js-switch');
        var switchery = new Switchery(elem, { });


    })
</script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_validate.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:16 GMT -->
</html>
